package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * Created by Administrater on 2015/12/8.
 */
public class CompleteActivityInfoTask extends CouponHttpBaseTask {
    private String mActivtyId;
    private String mFee;
    private String mPromisDish;
    private String mFacility;
    private String mDesc;

    public CompleteActivityInfoTask(String activityId,String fee, String promiseDish,String facility, String backup) {
        super(TaskType.COMPLETEACTIVITYINFO_TASK);
        mActivtyId = activityId;
        mFee = fee;
        mPromisDish = promiseDish;
        mFacility = facility;
        mDesc = backup;
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS, null);
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT) {
            CouponHttpRequest request = new CouponHttpRequest(RequestType.COMPLETEACTIVITYINFO_REQUEST);
            JSONObject json = new JSONObject();
            json.put("activityId",mActivtyId);
            json.put("fee", mFee);
            json.put("promiseDish",mPromisDish);
            json.put("facility",mFacility);
            json.put("backup",mDesc);
            request.setData(json.toString());
            request.setApiNo(ApiNo.COMPLETEACTIVITYINFO);
            addRequest(request);
        }
    }
}
